<template>
    <div class="mod-config">
        <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
                    <el-form-item>
                        <el-input v-model="dataForm.yaoCaiMingCheng" placeholder="药材名称" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="dataForm.xuQiuLiang" placeholder="需求量" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="dataForm.guiGe" placeholder="规格" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="dataForm.lianXiRen" placeholder="联系人" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="dataForm.lianXiDianHua" placeholder="联系电话" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="dataForm.yaoCaiChanDi" placeholder="药材产地" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="dataForm.jiaoHuoDiZhi" placeholder="交货地址" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                      <el-input v-model="dataForm.ziZhiBiaoZhun" placeholder="资质标准" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                      <el-input v-model="dataForm.zhiLiangBiaoZhun" placeholder="质量标准" clearable></el-input>
                    </el-form-item>
<!--                    <el-form-item>
                        <el-input v-model="dataForm.qiYe" placeholder="企业" clearable></el-input>
                    </el-form-item>

                    <el-form-item>
                        <el-input v-model="dataForm.piaoJu" placeholder="票据" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="dataForm.fuKuanFangShi" placeholder="付款方式" clearable></el-input>
                    </el-form-item>-->
                    <el-form-item>
<!--                        <el-input v-model="dataForm.shiFouShangJia" placeholder="上架状态" clearable></el-input>-->
                      <el-select v-model="dataForm.shiFouShangJia"  clearable  placeholder="上架状态">
                        <el-option label="上架" value='上架'></el-option>
                        <el-option label="下架" value='下架'></el-option>
                      </el-select>
                    </el-form-item>
<!--                    <el-form-item>
                        <el-input v-model="dataForm.jiYang" placeholder="寄样" clearable></el-input>
                    </el-form-item>
                    <el-form-item>
                        <el-input v-model="dataForm.baoZhuang" placeholder="包装" clearable></el-input>
                    </el-form-item>-->
            <el-form-item>
                <el-button @click="getDataList(1)">查询</el-button>
<!--                <el-button type="primary" @click="addOrUpdateHandle()">新增
                </el-button>
                <el-button type="danger" @click="deleteHandle()"
                           :disabled="dataListSelections.length <= 0">批量删除
                </el-button>-->
            </el-form-item>
        </el-form>
        <el-table
                :data="dataList"
                border
                v-loading="dataListLoading"
                @selection-change="selectionChangeHandle"
                style="width: 100%;">
            <el-table-column
                    label="选中"
                    type="selection"
                    header-align="center"
                    align="center"
                    width="50">
            </el-table-column>
            <el-table-column
                    type="index"
                    label="序号"
                    header-align="center"
                    align="center"
                    width="50">
            </el-table-column>
                    <el-table-column
                            prop="yaoCaiMingCheng"
                            header-align="center"
                            align="center"
                            label="药材名称">
                    </el-table-column>
                    <el-table-column
                            prop="xuQiuLiang"
                            header-align="center"
                            align="center"
                            label="需求量">
                    </el-table-column>
                    <el-table-column
                            prop="guiGe"
                            header-align="center"
                            align="center"
                            label="规格">
                    </el-table-column>
          <el-table-column
            prop="shiFouShangJia"
            header-align="center"
            align="center"
            label="上架状态">
          </el-table-column>
                    <el-table-column
                            prop="lianXiRen"
                            header-align="center"
                            align="center"
                            label="联系人">
                    </el-table-column>
                    <el-table-column
                            prop="lianXiDianHua"
                            header-align="center"
                            align="center"
                            label="联系电话">
                    </el-table-column>
                    <el-table-column
                            prop="yaoCaiChanDi"
                            header-align="center"
                            align="center"
                            label="药材产地">
                    </el-table-column>
                    <el-table-column
                            prop="jiaoHuoDiZhi"
                            header-align="center"
                            align="center"
                            label="交货地址">
                    </el-table-column>
                    <el-table-column
                            prop="faBuShiJian"
                            header-align="center"
                            align="center"
                            label="发布时间">
                    </el-table-column>
                    <el-table-column
                            prop="baoJiaRenShu"
                            header-align="center"
                            align="center"
                            label="报价人数">
                    </el-table-column>
<!--                    <el-table-column
                            prop="qiYe"
                            header-align="center"
                            align="center"
                            label="企业">
                    </el-table-column>
                    <el-table-column
                            prop="ziZhiBiaoZhun"
                            header-align="center"
                            align="center"
                            label="资质标准">
                    </el-table-column>
                    <el-table-column
                            prop="zhiLiangBiaoZhun"
                            header-align="center"
                            align="center"
                            label="质量标准">
                    </el-table-column>
                    <el-table-column
                            prop="piaoJu"
                            header-align="center"
                            align="center"
                            label="票据">
                    </el-table-column>
                    <el-table-column
                            prop="fuKuanFangShi"
                            header-align="center"
                            align="center"
                            label="付款方式">
                    </el-table-column>

                    <el-table-column
                            prop="yaoCaiTuPian"
                            header-align="center"
                            align="center"
                            label="药材图片">
                    </el-table-column>
                    <el-table-column
                            prop="jiYang"
                            header-align="center"
                            align="center"
                            label="寄样">
                    </el-table-column>
                    <el-table-column
                            prop="baoZhuang"
                            header-align="center"
                            align="center"
                            label="包装">
                    </el-table-column>-->
            <el-table-column
                    fixed="right"
                    header-align="center"
                    align="center"
                    label="操作">
                <template slot-scope="scope">
                    <el-button type="text" size="small"
                               @click="infoHandle(scope.row.id)"><i class="el-icon-edit"></i>查看详情</el-button>
                  <el-button type="text" size="small"
                             @click="xiaJiaHandel(scope.row.id)"><i class="el-icon-edit"></i>下架</el-button>
<!--                    <el-button type="text" size="small"
                               @click="addOrUpdateHandle(scope.row.id)"><i class="el-icon-edit"></i>修改</el-button>-->
<!--                    <el-button type="text" size="small"-->
<!--                               @click="deleteHandle(scope.row.id)"><i class="el-icon-delete"></i>删除</el-button>-->
                </template>
            </el-table-column>
        </el-table>
        <el-pagination
                @size-change="sizeChangeHandle"
                @current-change="currentChangeHandle"
                :current-page="pageIndex"
                :page-sizes="[10, 20, 50, 100]"
                :page-size="pageSize"
                :total="totalPage"
                layout="total, sizes, prev, pager, next, jumper">
        </el-pagination>
        <!-- 弹窗, 新增 / 修改 -->
        <el-dialog title="添加或编辑" :visible.sync="addOrUpdateVisible">
            <el-form :rules="dataRule" :model="dataSaveForm" ref="dataForm" @keyup.enter.native="dataFormSubmit()">
                <el-form-item hidden :label-width="'120px'"  prop="id">
                    <el-input v-model="dataSaveForm.id" autocomplete="off"></el-input>
                </el-form-item>
                        <el-form-item label="药材名称" :label-width="'120px'"  prop="yaoCaiMingCheng">
                            <el-input v-model="dataSaveForm.yaoCaiMingCheng" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="需求量" :label-width="'120px'"  prop="xuQiuLiang">
                            <el-input v-model="dataSaveForm.xuQiuLiang" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="规格" :label-width="'120px'"  prop="guiGe">
                            <el-input v-model="dataSaveForm.guiGe" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="联系人" :label-width="'120px'"  prop="lianXiRen">
                            <el-input v-model="dataSaveForm.lianXiRen" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="联系电话" :label-width="'120px'"  prop="lianXiDianHua">
                            <el-input v-model="dataSaveForm.lianXiDianHua" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="药材产地" :label-width="'120px'"  prop="yaoCaiChanDi">
                            <el-input v-model="dataSaveForm.yaoCaiChanDi" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="交货地址" :label-width="'120px'"  prop="jiaoHuoDiZhi">
                            <el-input v-model="dataSaveForm.jiaoHuoDiZhi" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="发布时间" :label-width="'120px'"  prop="faBuShiJian">
                            <el-input v-model="dataSaveForm.faBuShiJian" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="报价人数" :label-width="'120px'"  prop="baoJiaRenShu">
                            <el-input v-model="dataSaveForm.baoJiaRenShu" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="企业" :label-width="'120px'"  prop="qiYe">
                            <el-input v-model="dataSaveForm.qiYe" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="资质标准" :label-width="'120px'"  prop="ziZhiBiaoZhun">
                            <el-input v-model="dataSaveForm.ziZhiBiaoZhun" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="质量标准" :label-width="'120px'"  prop="zhiLiangBiaoZhun">
                            <el-input v-model="dataSaveForm.zhiLiangBiaoZhun" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="票据" :label-width="'120px'"  prop="piaoJu">
                            <el-input v-model="dataSaveForm.piaoJu" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="付款方式" :label-width="'120px'"  prop="fuKuanFangShi">
                            <el-input v-model="dataSaveForm.fuKuanFangShi" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="是否上架" :label-width="'120px'"  prop="shiFouShangJia">
<!--                            <el-input v-model="dataSaveForm.shiFouShangJia" autocomplete="off"></el-input>-->
                          <el-select v-model="dataSaveForm.shiFouShangJia"  clearable style="width: 100%" placeholder="是否上架">
                            <el-option label="上架" value='上架'></el-option>
                            <el-option label="下架" value='下架'></el-option>
                          </el-select>
                        </el-form-item>
                        <el-form-item label="药材图片" :label-width="'120px'"  prop="yaoCaiTuPian">
<!--                            <el-input v-model="dataSaveForm.yaoCaiTuPian" autocomplete="off"></el-input>-->
                          <img-upload
                            v-model="dataSaveForm.yaoCaiTuPian"
                            :file-id="dataSaveForm.yaoCaiTuPian"
                            :list="list1"
                            :is-boolean="isBoolean1"
                            ref="pic1"
                          >
                          </img-upload>
                        </el-form-item>
                        <el-form-item label="寄样" :label-width="'120px'"  prop="jiYang">
                            <el-input v-model="dataSaveForm.jiYang" autocomplete="off"></el-input>
                        </el-form-item>
                        <el-form-item label="包装" :label-width="'120px'"  prop="baoZhuang">
                            <el-input v-model="dataSaveForm.baoZhuang" autocomplete="off"></el-input>
                        </el-form-item>

            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="qx()">取 消</el-button>
                <el-button type="primary" @click="dataFormSubmit()">确 定</el-button>
            </div>
        </el-dialog>


        <!-- 详情-->
        <el-dialog title="采购管理药材采购" :visible.sync="infoVisible" :modal-append-to-body="false" :modal="false" >
            <div class="mod-config">
              <el-row>
                <div class="el-descriptions__title custom-title">采购详情</div>
              </el-row>
              <el-row :gutter="0" style="display: flex">
                <el-col :span="10" style="align-items: stretch;margin-right: 16px;">
                  <img class="devImg" fit="fill" v-if="infoList.yaoCaiTuPian" style="width: 100%;height: 330px" :src="this.$http.adornUrl('/api-file/file/view/file?fileId='+ infoList.yaoCaiTuPian) ">
                 <img class="devImg" v-else style="width: 100%;height: 330px" src="../../../../static/img/zwtp.png">
                  <el-descriptions :column="1"   :colon="false" content-class-name="my-content">
                    <el-descriptions-item label="">{{this.infoList.yaoCaiMingCheng}}</el-descriptions-item>
                  </el-descriptions>
                  <p style="text-align: center;font-size: 14px">发布时间:{{this.infoList.faBuShiJian}}</p>
                </el-col>
                <el-col :span="10">
                  <el-descriptions :column="1" label-class-name="myLableClassName" >
                    <el-descriptions-item label="规格">{{this.infoList.guiGe}}</el-descriptions-item>
                    <el-descriptions-item label="药材产地">{{this.infoList.yaoCaiChanDi}}</el-descriptions-item>
                    <el-descriptions-item label="企业"><el-button type="text" size="small"
                                                                                        @click="dianPuInfo(infoList.guanLianYongHu)">{{this.infoList.qiYe}}</el-button></el-descriptions-item>
                    <el-descriptions-item label="可供票据">{{this.infoList.piaoJu}}</el-descriptions-item>
                    <el-descriptions-item label="资质标准">{{this.infoList.ziZhiBiaoZhun}}</el-descriptions-item>
                    <el-descriptions-item label="质量标准">{{this.infoList.zhiLiangBiaoZhun}}</el-descriptions-item>
                    <el-descriptions-item label="付款方式">{{this.infoList.fuKuanFangShi}}</el-descriptions-item>
                    <el-descriptions-item label="联系人">{{this.infoList.lianXiRen}}</el-descriptions-item>
                    <el-descriptions-item label="联系电话">{{this.infoList.lianXiDianHua}}</el-descriptions-item>
                    <el-descriptions-item label="交货地">{{this.infoList.jiaoHuoDiZhi}}</el-descriptions-item>
                  </el-descriptions>
                </el-col>
                <el-col :span="4">
                  <p style="text-align: left;font-size: 18px;font-weight:bold;color: red">需求量：{{this.infoList.xuQiuLiang}}公斤</p>
                  <p style="text-align: left;font-size: 20px;font-weight:bold;color: #00a2d4">{{this.infoList.baoJiaRenShu}}</p>
                  <p style="text-align: left;font-size: 20px;font-weight:bold;color: #00a2d4">{{this.infoList.shiFouShangJia}}</p>
                </el-col>
              </el-row>
              <el-row>
                <div class="el-descriptions__title custom-title">报价详情</div>
              </el-row>
              <el-row>
                <bao-jia-zu-jian ref="baoJ"></bao-jia-zu-jian>
              </el-row>
              <el-row>
                <dian-pu-info ref="dianpu" v-if="dianPuInfoVisible"></dian-pu-info>
              </el-row>
<!--              ===================================-->
<!--                <el-descriptions :column="2" :colon="false" title="设备信息">
                            <el-descriptions-item label="药材名称">{{this.infoList.yaoCaiMingCheng}}</el-descriptions-item>
                            <el-descriptions-item label="需求量">{{this.infoList.xuQiuLiang}}</el-descriptions-item>
                            <el-descriptions-item label="规格">{{this.infoList.guiGe}}</el-descriptions-item>
                            <el-descriptions-item label="状态">{{this.infoList.zhuangTai}}</el-descriptions-item>
                            <el-descriptions-item label="联系人">{{this.infoList.lianXiRen}}</el-descriptions-item>
                            <el-descriptions-item label="联系电话">{{this.infoList.lianXiDianHua}}</el-descriptions-item>
                            <el-descriptions-item label="药材产地">{{this.infoList.yaoCaiChanDi}}</el-descriptions-item>
                            <el-descriptions-item label="交货地址">{{this.infoList.jiaoHuoDiZhi}}</el-descriptions-item>
                            <el-descriptions-item label="发布时间">{{this.infoList.faBuShiJian}}</el-descriptions-item>
                            <el-descriptions-item label="报价人数">{{this.infoList.baoJiaRenShu}}</el-descriptions-item>
                            <el-descriptions-item label="企业">{{this.infoList.qiYe}}</el-descriptions-item>
                            <el-descriptions-item label="资质标准">{{this.infoList.ziZhiBiaoZhun}}</el-descriptions-item>
                            <el-descriptions-item label="质量标准">{{this.infoList.zhiLiangBiaoZhun}}</el-descriptions-item>
                            <el-descriptions-item label="票据">{{this.infoList.piaoJu}}</el-descriptions-item>
                            <el-descriptions-item label="付款方式">{{this.infoList.fuKuanFangShi}}</el-descriptions-item>
                            <el-descriptions-item label="是否上架">{{this.infoList.shiFouShangJia}}</el-descriptions-item>
                            <el-descriptions-item label="药材图片">{{this.infoList.yaoCaiTuPian}}</el-descriptions-item>
                            <el-descriptions-item label="寄样">{{this.infoList.jiYang}}</el-descriptions-item>
                            <el-descriptions-item label="包装">{{this.infoList.baoZhuang}}</el-descriptions-item>
                            <el-descriptions-item label="关联用户">{{this.infoList.guanLianYongHu}}</el-descriptions-item>
                </el-descriptions>-->
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button @click="qxinfo()">取 消</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
    import ImgUpload from "../../components/upload/ImgUpload.vue";
    import baoJiaZuJian from "./baoJiaZuJian.vue";
    import dianPuInfo from "../keHuGuanLi/dianPuInfo.vue";
    export default {
      components: {ImgUpload,baoJiaZuJian,dianPuInfo},
        data() {
            return {
                dataForm: {
                                yaoCaiMingCheng:'',
                                xuQiuLiang:'',
                                guiGe:'',
                                zhuangTai:'',
                                lianXiRen:'',
                                lianXiDianHua:'',
                                yaoCaiChanDi:'',
                                jiaoHuoDiZhi:'',
                                faBuShiJian:'',
                                baoJiaRenShu:'',
                                qiYe:'',
                                ziZhiBiaoZhun:'',
                                zhiLiangBiaoZhun:'',
                                piaoJu:'',
                                fuKuanFangShi:'',
                                shiFouShangJia:'',
                                yaoCaiTuPian:'',
                                jiYang:'',
                                baoZhuang:'',
                                guanLianYongHu:'',
                },
                dataSaveForm: {
                                yaoCaiMingCheng:'',
                                xuQiuLiang:'',
                                guiGe:'',
                                zhuangTai:'',
                                lianXiRen:'',
                                lianXiDianHua:'',
                                yaoCaiChanDi:'',
                                jiaoHuoDiZhi:'',
                                faBuShiJian:'',
                                baoJiaRenShu:'',
                                qiYe:'',
                                ziZhiBiaoZhun:'',
                                zhiLiangBiaoZhun:'',
                                piaoJu:'',
                                fuKuanFangShi:'',
                                shiFouShangJia:'',
                                yaoCaiTuPian:'',
                                jiYang:'',
                                baoZhuang:'',
                },
                dataRule: {
                                yaoCaiMingCheng: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                xuQiuLiang: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                guiGe: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                lianXiRen: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                lianXiDianHua: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                yaoCaiChanDi: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                jiaoHuoDiZhi: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                qiYe: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                ziZhiBiaoZhun: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                zhiLiangBiaoZhun: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                piaoJu: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                fuKuanFangShi: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                shiFouShangJia: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                yaoCaiTuPian: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                jiYang: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],
                                baoZhuang: [
                                {required: true, message: '不能为空', trigger: 'blur'}
                            ],

                },
                dataList: [],
                pageIndex: 1,
                pageSize: 10,
                totalPage: 0,
                dataListLoading: false,
                dataListSelections: [],
                addOrUpdateVisible: false,

                infoList:[],
                infoLoading: false,
                infoVisible: false,
              list1:[],
              isBoolean1: false,
              dianPuInfoVisible:false
            }
        },

        activated() {
            this.getDataList()
        },
        methods: {
          xiaJiaHandel(id){
            this.$http({
              url: this.$http.adornUrl(`/api-trading/caiGouGuanLi/caiGouGuanLiYaoCaiCaiGou/save`),
              method: 'post',
              data: this.$http.adornData({
                'id': id,
                'shiFouShangJia': "下架",
              })
            }).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                    this.addOrUpdateVisible = false
                    this.getDataList()
                  }
                })
              } else {
                this.$message.error(data.msg)
              }
            })
          },
          dianPuInfo(yonghuid) {
            this.dianPuInfoVisible = true;
            console.log(yonghuid)
            this.$nextTick(() => {
              this.$refs.dianpu.init(yonghuid)
            })
          },
            getDataList(pageIndex) {
                if (pageIndex) {
                    this.pageIndex = pageIndex
                }
                this.dataListLoading = true
                this.$http({
                    url: this.$http.adornUrl('/api-trading/caiGouGuanLi/caiGouGuanLiYaoCaiCaiGou/getList'),
                        method: 'get',
            params: this.$http.adornParams({
                'page': this.pageIndex,
                        'limit': this.pageSize,
                'yaoCaiMingCheng': this.dataForm.yaoCaiMingCheng,
                'xuQiuLiang': this.dataForm.xuQiuLiang,
                'guiGe': this.dataForm.guiGe,
                'zhuangTai': this.dataForm.zhuangTai,
                'lianXiRen': this.dataForm.lianXiRen,
                'lianXiDianHua': this.dataForm.lianXiDianHua,
                'yaoCaiChanDi': this.dataForm.yaoCaiChanDi,
                'jiaoHuoDiZhi': this.dataForm.jiaoHuoDiZhi,
                'faBuShiJian': this.dataForm.faBuShiJian,
                'baoJiaRenShu': this.dataForm.baoJiaRenShu,
                'qiYe': this.dataForm.qiYe,
                'ziZhiBiaoZhun': this.dataForm.ziZhiBiaoZhun,
                'zhiLiangBiaoZhun': this.dataForm.zhiLiangBiaoZhun,
                'piaoJu': this.dataForm.piaoJu,
                'fuKuanFangShi': this.dataForm.fuKuanFangShi,
                'shiFouShangJia': this.dataForm.shiFouShangJia,
                'yaoCaiTuPian': this.dataForm.yaoCaiTuPian,
                'jiYang': this.dataForm.jiYang,
                'baoZhuang': this.dataForm.baoZhuang,

            })
            }).then(({data}) => {
                    if (data && data.code === 0) {
                        this.dataList = data.data.list
                        this.totalPage = Number(data.data.totalCount)
                    } else {
                        this.dataList = []
                        this.totalPage = 0
                    }
                    this.dataListLoading = false
                })
            },
            // 每页数
            sizeChangeHandle(val) {
                this.pageSize = val
                this.pageIndex = 1
                this.getDataList()
            },
            // 当前页
            currentChangeHandle(val) {
                this.pageIndex = val
                this.getDataList()
            },
            // 多选
            selectionChangeHandle(val) {
                this.dataListSelections = val
            },
            qx() {
                this.addOrUpdateVisible = false;

            },
            // 新增 / 修改
            addOrUpdateHandle(id) {
                this.addOrUpdateVisible = true;
              this.list1=[];
                this.$nextTick(() => {
                    this.$refs['dataForm'].resetFields()
                    if (id) {
                        this.$http({
                    url: this.$http.adornUrl(`/api-trading/caiGouGuanLi/caiGouGuanLiYaoCaiCaiGou/getById`),
                                method: 'get',
                                params: this.$http.adornParams({"id":id})
                    }).then(({data}) => {
                            if (data && data.code === 0) {
                                this.dataSaveForm.id = data.data.id
                                this.dataSaveForm.yaoCaiMingCheng = data.data.yaoCaiMingCheng;
                                this.dataSaveForm.xuQiuLiang = data.data.xuQiuLiang;
                                this.dataSaveForm.guiGe = data.data.guiGe;
                                this.dataSaveForm.zhuangTai = data.data.zhuangTai;
                                this.dataSaveForm.lianXiRen = data.data.lianXiRen;
                                this.dataSaveForm.lianXiDianHua = data.data.lianXiDianHua;
                                this.dataSaveForm.yaoCaiChanDi = data.data.yaoCaiChanDi;
                                this.dataSaveForm.jiaoHuoDiZhi = data.data.jiaoHuoDiZhi;
                                this.dataSaveForm.faBuShiJian = data.data.faBuShiJian;
                                this.dataSaveForm.baoJiaRenShu = data.data.baoJiaRenShu;
                                this.dataSaveForm.qiYe = data.data.qiYe;
                                this.dataSaveForm.ziZhiBiaoZhun = data.data.ziZhiBiaoZhun;
                                this.dataSaveForm.zhiLiangBiaoZhun = data.data.zhiLiangBiaoZhun;
                                this.dataSaveForm.piaoJu = data.data.piaoJu;
                                this.dataSaveForm.fuKuanFangShi = data.data.fuKuanFangShi;
                                this.dataSaveForm.shiFouShangJia = data.data.shiFouShangJia;
                                this.dataSaveForm.yaoCaiTuPian = data.data.yaoCaiTuPian;
                              if(data.data.yaoCaiTuPian){
                                this.list1=[];
                                this.list1.push({name: 'img', url: this.$http.adornUrl('/api-file/file/view/file?fileId=' + data.data.yaoCaiTuPian)})
                                this.isBoolean1 = true
                              }
                                this.dataSaveForm.jiYang = data.data.jiYang;
                                this.dataSaveForm.baoZhuang = data.data.baoZhuang;
                                this.dataSaveForm.guanLianYongHu = data.data.guanLianYongHu;
                            }
                        })
                    }
                })

            },
            qxinfo() {
                this.infoVisible = false;

            },
            // 新增 / 修改
            infoHandle(id) {
                this.infoVisible = true;
              this.$nextTick(() => {
                this.$refs.baoJ.init(id)
              })
                this.infoList=[];
                this.$http({
            url: this.$http.adornUrl(`/api-trading/caiGouGuanLi/caiGouGuanLiYaoCaiCaiGou/getById`),
                        method: 'get',
                        params: this.$http.adornParams({"id":id})
            }).then(({data}) => {
                    if (data && data.code === 0) {
                        this.infoList=data.data;
                    }
                })
            },
            // 删除
            deleteHandle(id) {
                var ids = id ? [id] : this.dataListSelections.map(item => {
                    return item.id
                })
                this.$confirm(`确定要进行删除操作?`, '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.$http({
                        url: this.$http.adornUrl('/api-trading/caiGouGuanLi/caiGouGuanLiYaoCaiCaiGou/delByIds'),
                            method: 'post',
                            data: this.$http.adornData(ids, false)
                }).then(({data}) => {
                        if (data && data.code === 0) {
                            this.$message({
                                message: '操作成功',
                                type: 'success',
                                duration: 1500,
                                onClose: () => {
                                    this.getDataList()
                                }
                            })
                        } else {
                        this.$message.error(data.msg)
                        }
                    })
                })
            },
            // 表单提交
            dataFormSubmit() {
            this.$refs['dataForm'].validate((valid) => {
                    if (valid) {
                        this.$http({
                    url: this.$http.adornUrl(`/api-trading/caiGouGuanLi/caiGouGuanLiYaoCaiCaiGou/save`),
                                method: 'post',
                    data: this.$http.adornData({
                    'id': this.dataSaveForm.id || undefined,
                        'yaoCaiMingCheng': this.dataSaveForm.yaoCaiMingCheng,
                        'xuQiuLiang': this.dataSaveForm.xuQiuLiang,
                        'guiGe': this.dataSaveForm.guiGe,
                        'zhuangTai': this.dataSaveForm.zhuangTai,
                        'lianXiRen': this.dataSaveForm.lianXiRen,
                        'lianXiDianHua': this.dataSaveForm.lianXiDianHua,
                        'yaoCaiChanDi': this.dataSaveForm.yaoCaiChanDi,
                        'jiaoHuoDiZhi': this.dataSaveForm.jiaoHuoDiZhi,
                        'faBuShiJian': this.dataSaveForm.faBuShiJian,
                        'baoJiaRenShu': this.dataSaveForm.baoJiaRenShu,
                        'qiYe': this.dataSaveForm.qiYe,
                        'ziZhiBiaoZhun': this.dataSaveForm.ziZhiBiaoZhun,
                        'zhiLiangBiaoZhun': this.dataSaveForm.zhiLiangBiaoZhun,
                        'piaoJu': this.dataSaveForm.piaoJu,
                        'fuKuanFangShi': this.dataSaveForm.fuKuanFangShi,
                        'shiFouShangJia': this.dataSaveForm.shiFouShangJia,
                        'yaoCaiTuPian': this.dataSaveForm.yaoCaiTuPian,
                        'jiYang': this.dataSaveForm.jiYang,
                        'baoZhuang': this.dataSaveForm.baoZhuang,
                        'guanLianYongHu': this.dataSaveForm.guanLianYongHu,
                    })
                    }).then(({data}) => {
                            if (data && data.code === 0) {
                                this.$message({
                                    message: '操作成功',
                                    type: 'success',
                                    duration: 1500,
                                    onClose: () => {
                                        this.addOrUpdateVisible = false
                                        this.getDataList()
                                    }
                                })
                            } else {
                            this.$message.error(data.msg)
                            }
                        })
                    }
                })


            },
        }
    }
</script>
<style>
.imgBox {
  border: 1px solid #ebeef5;
  border-left: none;
  width: 100%;
  height: 100%;
  position: relative;
  .devImg {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: auto;
    max-height: 100%;
    padding: 12px 10px;
  }
}
.my-content{
  display: flex;
  justify-content: center; /* 水平居中 */
  align-items: center; /* 垂直居中 */
//height: 100vh; /* 设置容器高度为视口高度 */
  align-items:center;text-align: center;
  font-weight:bold;font-size: 18px;

}
.custom-title{
  margin-bottom: 20px;
//margin-top: 20px;
}
.myLableClassName {
  color: rgb(19 35 29 / 77%);text-align:right;font-weight:bold;font-size: 16px;
}
</style>
